package linlin;

import java.util.List;
import java.util.Scanner;

/**
 * Created by lingfengsan on 2018/9/15.
 *
 I'm,king,of,the,world
 3

 I'm
 king
 of
 the
 world
 * @author lingfengsan
 */
public class Main_SF {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int maxWidth=sc.nextInt();

        String[]words=str.split(",");
        for (int i = 0; i <words.length ; i++) {
            if(words[i].length()>maxWidth){
                System.out.println(words[i]);
            }else{
                System.out.println(words[i]);
            }
        }
    }

}
